package com.woniuxy.demo.epai.service.impl;

import com.woniuxy.demo.epai.model.Artical;
import com.woniuxy.demo.epai.dao.ArticalMapper;
import com.woniuxy.demo.epai.service.IArticalService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 文章表 服务实现类
 * </p>
 *
 * @author epai
 * @since 2021-04-12
 */
@Service
@Slf4j
public class ArticalServiceImpl  implements IArticalService{

    @Autowired
    private ArticalMapper articalMapper;

    @Override
    @Cacheable(value="Artical",key = "'Artical_'+#cid")
    public List<Artical> queryByCid(int cid) {
        List<Artical> byCid = articalMapper.findByType(cid);
        log.info("查询文章{}",byCid);
        return byCid;
    }
}
